/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.cfg.servlet;

import cz.muni.fi.cfg.forms.TransformationException;
import cz.muni.fi.cfg.forms.Transformations;
import cz.muni.fi.cfg.grammar.ContextFreeGrammar;
import cz.muni.fi.cfg.parser.Parser;
import cz.muni.fi.cfg.parser.ParserException;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author NICKT
 */
public class Main {

    public static void main(String[] args) throws ParserException, TransformationException {
        Parser p = new Parser();
        ContextFreeGrammar a = p.parse("S -> A | B | b,A -> B,B -> C,C -> a | D,D -> a | A");
        ContextFreeGrammar b = p.parse("S' -> A | B | b,A -> B,B -> C,C -> a | D,D -> a | A");
//        ContextFreeGrammar b = p.parse("S -> A | B | b,A -> B,B -> A,C -> a | D,D -> a | C");
//        List<String> s = p.orderingOfNonTerminals("S->Sa|a|Ba,A->ABS|a,B->BS|aS|aA");
//        Transformations t = new Transformations();
//        System.out.println(a);
////        System.out.println(a.getTerminals());
////        System.out.println(a.getNonTerminals());
//        Map<ContextFreeGrammar, List[]> m = t.removeLeftRecursion(b, s);
//        Set<ContextFreeGrammar> set = m.keySet();
//        Set<String> k = a.getNonTerminals();
//        Set<String> l = null;
//        ContextFreeGrammar n = null;
//        for (ContextFreeGrammar c : set) {
//            System.out.println(c.getTerminals());
//            System.out.println(c.getNonTerminals());
//            System.out.println(c);
//            l = c.getNonTerminals();
//            n = c;
//        }
        boolean bool = a.equals(b);
        System.out.println(bool);
    }
}
